<include file="public@header" />
<style type="text/css">
    .form-group{
        margin-left: 0 !important;
        margin-right:0 !important;}

    .control-group1 label{ width:100%; float:left}
    .form-horizontal .control-group1 {
        float: left;
        width: 15%;
        margin-bottom: 20px;
    }
    .form-horizontal .control-label {width:100px;}
    input,select, textarea, .uneditable-input {
        max-width: 100%;
        width:auto;
        min-width:60px;
    }
    input{ width:auto;}
</style>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li><a href="{:url('orders/visua')}">{:lang('可视化墓区')}</a></li>
        <li class="active"><a href="">格位信息</a></li>
    </ul>
    <form class="form-horizontal js-ajax-form" method="post"  action="{:url('deposit/tomb_deposit')}" enctype="multipart/form-data" style="width:80%;float:left;">
        <fieldset>
            <div class="p_title">
                <span class="span_title">格位详情</span>
            </div>
            <div class="control-group1-p" style="border:1px solid #e2e2e2; padding-top:20px;">
                <div class="form-group">
                    <label class="control-label">壁式:</label>
                    <div class="col-lg-2">
                        <select class="form-control" name="funeral" disabled >
                            <option value="壁葬">壁葬</option>
                        </select>
                    </div>
                    <label class="control-label">空间长度:</label>
                    <div class="col-lg-2">
                        <input type="text" class="form-control" name="footprint" style="width: 100px;" value="{$result.footprint|default=''}"  disabled>mm
                    </div>
                    <label class="control-label">空间宽度:</label>
                    <div class="col-lg-2">
                        <input type="text" class="form-control" name="tombstone_w" style="width: 100px;"value="{$result.tombstone_w|default=''}" disabled >mm
                    </div>
                    <label class="control-label">空间高度:</label>
                    <div class="col-lg-2">
                        <input type="text" class="form-control" name="tombstone_h" style="width: 100px;"value="{$result.tombstone_h|default=''}" disabled >mm
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label">所在层数:</label>
                    <div class="col-lg-2">
                        <input type="text" class="form-control" name="layer_num" value="{$result.layer_num|default=''}"  disabled>
                    </div>
                    <label class="control-label">墓穴规制:</label>
                    <div class="col-lg-2">
                        <select class="form-control" name="tomb_regulation" disabled >
                            <option value="1" <if condition="1 eq  isset($result['tomb_regulation'])?$result['tomb_regulation']:0">selected</if>>单穴</option>
                            <option value="2" <if condition="2 eq  isset($result['tomb_regulation'])?$result['tomb_regulation']:0">selected</if>>双穴</option>
                            <option value="3" <if condition="3 eq  isset($result['tomb_regulation'])?$result['tomb_regulation']:0">selected</if>>三穴</option>
                        </select>
                    </div>
                    <label class="control-label">收敛形式:</label>
                    <div class="col-lg-2">
                        <select class="form-control" name="order[convergence]"   >
                            <foreach name="tomb_convergence.jd" item="vo">
                                <option value="{$vo}" <if condition="$vo eq  $result['convergence'] ">selected </if>>{$vo}</option>
                            </foreach>
                        </select>
                    </div>
                    <label class="control-label ">售后质保期:</label>
                    <div class="col-lg-2">
                        <select class="form-control" name="warranty"  disabled>
                            <option value="3" >购买起计3年</option>
                        </select>
                    </div>
                </div>

                <div class="form-group  ">
                    <label class="control-label">墓穴维护期:</label>
                    <div class="col-lg-2">
                        <select class="form-control" name="maintain"  disabled>
                            <option value="20" >首位安葬起20年</option>
                        </select>
                    </div>
                    <label class="control-label">抵顶人:</label>
                    <div class="col-lg-2">
                        <input type="text" class="form-control" name="substitute" value="{$result.substitute|default=''}" disabled>
                    </div>
                    <label class="control-label">类型:</label>
                    <div class="col-lg-2">
                        <select class="form-control"  disabled >
                            <option value="4" >节地墓</option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="p_title">
                <span class="span_title">订单详情</span>
                <input type="hidden" name="order[order_id]" value="{$result.order_id|default=''}">
                <input type="hidden" name="order[tomb_product_id]" value="{$result.id}">
                <input type="hidden" name="order[tomb_type]" value="{$cate_id}">
                <input type="hidden" name="order[tomb_id]" value="{$result.colID|default=''}">
                <input type="hidden" name="order[tomb_num]" value="{$result.num|default=''}">
            </div>
            <div class="control-group1-p" style="border:1px solid #e2e2e2; padding-top:20px;">
                <div class="form-group">
                    <label class="control-label">格位编号</label>
                    <div class="col-lg-2">
                        <input type="text"  class="form-control" disabled value="{$result.num|default=''}">
                    </div>
                    <label class="control-label">所在区域</label>
                    <div class="col-lg-2">
                        <input type="text" name="tomb_region" class="form-control" value="{$result.tomb_region|default=''}" disabled>
                    </div>

                    <label class="control-label">所在位置</label>
                    <div class="col-lg-2">
                        <input type="text" name="tomb_address" class="form-control" value="{$result.tomb_address|default=''}" disabled>
                    </div>
                    <label class="control-label">所在层数</label>
                    <div class="col-lg-2">
                        <input type="text" name="layer_num" class="form-control" value="{$result.layer_num|default=''}" disabled>
                    </div>
                </div>

                <div class="form-group">
                    <label class="control-label">所在位号</label>
                    <div class="col-lg-2">
                        <input type="text" name="tomb_bit_number" class="form-control" value="{$result.tomb_bit_number|default=''}" disabled>
                    </div>
                    <label class="control-label">单年费用</label>
                    <div class="col-lg-2" >
<!--                        <input type="hidden" name="order[discount_ratio]" class="form-control discount_ratio"  value="{$result.selling_price|default=''}" >-->
                        <input type="text"   name="order[selling_price]" class="form-control danjia" value="{$deposit_cost|default=''}" style="width: 150px;" >元/年
                    </div>
                    <label class="control-label">骨灰寄存</label>
                    <div class="col-lg-2"  >
                        <input type="hidden"name="order[deposit_storage]"  class="jicuishichang " data-deposit_storage="{$result.deposit_storage|default=''}" />
                        <select  class="form-control jicuisj">
                            <if condition="isset($result['deposit_storage'])">
                                <option value="1"   <if condition="$result.deposit_storage eq 1">selected</if> >寄存一年</option>
                                <option value="2"   <if condition="$result.deposit_storage eq 2">selected</if> >寄存两年</option>
                                <option value="3"   <if condition="$result.deposit_storage eq 3">selected</if> >寄存三年</option>
                                <option value="4"   <if condition="$result.deposit_storage eq 4">selected</if> >寄存四年</option>
                                <option value="5"   <if condition="$result.deposit_storage eq 5">selected</if> >寄存五年</option>
                                <else/>
                                <option value="1">寄存一年</option>
                                <option value="2">寄存两年</option>
                                <option value="3">寄存三年</option>
                                <option value="4" >寄存四年</option>
                                <option value="5" >寄存五年</option>
                            </if>
                        </select>
                    </div>
                    <label class="control-label" >免费寄存</label>
                    <div class="col-md-2"  >
                        <select   name="order[discount_price]" class="form-control mianfei">
                            <option value="0">零年</option>
                            <if condition="isset($result['deposit_storage'])">
                                <option value="1" <if condition="$result.discount_price eq 1">selected</if> >一年</option>
                                <option value="2" <if condition="$result.discount_price eq 2">selected</if> >两年</option>
                                <option value="3" <if condition="$result.discount_price eq 3">selected</if> >三年</option>
                                <else/>
                                <option value="1" >一年</option>
                                <option value="2" >两年</option>
                                <option value="3" >三年</option>
                            </if>
                        </select>
                    </div>

                </div>
                <div class="form-group">
                    <label class="control-label" >优惠方案</label>
                    <div class="col-md-2" style=" ">
                        <select style=" width:auto;" class="form-control youhui" name="discount_duration">
                            <option value="0">无优惠</option>
                            <if condition="isset($result['closing_price'])">
                                <option value="1500/5" data-y="5" data-jg="1500"  <if condition="$result.closing_price eq '1500.00'">selected</if>>￥1500/5年</option>
                                <else/>
                                <option value="1500/5" data-y="5" data-jg="1500">￥1500/5年</option>
                            </if>
                        </select>
                    </div>
                   <!-- <label class="control-label">单年费用</label>
                    <div class="col-lg-3" style=" width: 16%; ">
                        <input type="text" name="order[discount_ratio]" class="form-control discount_ratio"  value="{$result.selling_price|default=''}"  style="width: 100px;display:inline-block">
                        <input type="hidden" name="order[discount_price]" class="discount_price" value="0" >
                        <input type="checkbox"   id="discount_price"   style=" min-width:20px;" <if condition="'2' eq isset($result['discount_price'])?$result['discount_price']:0 eq 1">checked </if>>免费一年
                    </div>-->
                    <label class="control-label">合计费用</label>
                    <div class="col-lg-2">
                        <input type="hidden" name="order[sales_total]" class="sales_total" value="{$result.sales_total|default=''}">
                        <input type="hidden" name="order[closing_price]" class="sales_total" value="{$result.closing_price|default=''}">
                        <input type="text"  class="form-control sales_total" value="{$result.sales_total|default=''}" disabled style="width: 150px">元
                    </div>
                    <label class="control-label">下单时间</label>
                    <div class="col-lg-2">
                        <input type="hidden"   name="add_time" value="{$result.add_order_time}"   >
                        <input type="text" class="form-control js-date" name="add_time" value="{$result.add_order_time}" disabled >
                    </div>
                </div>
                    <div class="form-group">
                        <label class="control-label">导购员</label>
                        <div class="col-lg-2">
                            <input type="hidden"   name="order[shoppingguide]" value="{$result.shoppingguide}" >
                            <input type="text" class="form-control" name="shoppingguide" disabled value="{$result.shoppingguide_name}">
                        </div>
                        <label class="control-label"  >代理商</label>
                        <div class="col-lg-2"  >
                            <select name="order[agent_user]"  style="width: 100%"  class="form-control">
                                <option value="0">请选择</option>
                                <foreach name="dailishang_list" item="vou">
                                    <if condition=" isset($result['agent_user'])">
                                        <option value="{$vou.id}" <if condition=" $result['agent_user'] eq $vou.id"> selected </if>>{$vou.department_name}-{$vou.user_nickname}</option>
                                        <else/>
                                        <option value="{$vou.id}">{$vou.department_name}-{$vou.user_nickname}</option>
                                    </if>
                                </foreach>
                            </select>
                        </div>
                        <label class="control-label">抵顶人</label>
                        <div class="col-lg-2">
                            <input type="text" class="form-control" name="reaching" value="{$result.reacher|default=''}" disabled >
                        </div>
                        <label class="control-label">经办人</label>
                        <div class="col-lg-2">
                            <input type="text" class="form-control" name="handle" value="{$result.handle|default=''}"  disabled>
                        </div>
                    </div>
            </div>
        </fieldset>
        <div class="form-actions" style="clear:both;">
            <button type="submit" class="btn btn-primary js-ajax-submit">下一步</button>
        </div>
    </form>
</div>
<script type="text/javascript" src="__STATIC__/js/admin.js?v={:time()}"></script>
<script>
    $(function () {
        var jicuisj = $('.jicuisj').val();//寄存多久
        $('.jicuishichang').val(jicuisj);
        var dj = $('.danjia').val(),
            num = $('.jicuishichang ').val();

        var hj = dj*num;
        $('.sales_total').val(hj)

    })
    //骨灰寄存 时长
    $('.jicuisj').change(function () {
        var jicuisj = $(this).val();//寄存多久
        $('.jicuishichang').val(jicuisj);
        var danjia = parseFloat($('.danjia').val()).toFixed(2),//单价
            mianfei  = $('.mianfei').val()*danjia,//免费一年
            sales_total  = parseFloat(jicuisj * danjia).toFixed(2)-mianfei;
        $('.sales_total').val( parseFloat(sales_total).toFixed(2));
    });

        // 免费寄存
    $('.mianfei').change(function () {
        var youhui = $('.youhui').children('option:selected').val();
        $('.youhui').val(0);
        console.log(youhui)
        if (youhui==0){
            // $('.jicuisj').val(1)
        }else {
            $('.jicuisj').val(1)
            $('.youhui').val(0)
        }
        var danjia =  $('.danjia').val();// 价格
        var jicuisj = $('.jicuisj').val();// 寄存时长
        var mianfei = $('.mianfei').val()*danjia;// 免费寄存时长
       var  sales_total  = parseFloat(danjia * jicuisj).toFixed(2)-mianfei;

        $('.sales_total').val(parseFloat(sales_total).toFixed(2));
    })

  //优惠方案
    $('.youhui').change(function () {
        $('.mianfei').val(0)
        var jg = $(this).children('option:selected').data('jg');
        var nian = $(this).children('option:selected').data('y');

        $('.jicuisj ').val(nian);
        // $('.discount_price').val(0)
        $('.sales_total').val(jg)
        $('.jicuishichang ').val(nian)

    })

   /* $('.discount_ratio').blur(function () {
        $('.discount_duration').val(0)
        var discount_price = $(this).val();
        var  deposit_storage = $('.deposit_storage').data('deposit_storage');
        $('.deposit_storage').val(deposit_storage);

        var closing_price = ($('.deposit_storage').val()-discount_price)*$('.selling_price').val()
        $('.closing_price').val(parseFloat(closing_price).toFixed(2));
        $('.closing_price_').val('￥'+(parseFloat(closing_price).toFixed(2)))

        $('.total_price').val(parseFloat(closing_price).toFixed(2))
    })*/

</script>
</body>
</html>